<?php
class Modulemanager_Model_Deletemodule implements Modulemanager_Model_Mainable{
    
    private $action_handler;
    
    private $excepted_result = 1;
    
    private $modulemanager_data_deletecontentvalues;
    private $modulemanager_data_deletemetavalues;
    private $modulemanager_data_deletemodulesettings;
    
    private $delete_contentvalues_result;
    private $delete_metavalues_result;
    private $delete_modulesettings_result;
    
    public function __construct() {
        $this->modulemanager_data_deletecontentvalues = new Modulemanager_Data_Deletecontentvalues;
        $this->modulemanager_data_deletemetavalues = new Modulemanager_Data_Deletemetavalues;
        $this->modulemanager_data_deletemodulesettings = new Modulemanager_Data_Deletemodulesettings;
    }
    
    public function main(array $variables = null){
        $this->delete_contentvalues_result = $this->modulemanager_data_deletecontentvalues->main($variables);
        $this->delete_metavalues_result = $this->modulemanager_data_deletemetavalues->main($variables);
        $this->delete_modulesettings_result = $this->modulemanager_data_deletemodulesettings->main($variables);
        if(
                ($this->delete_contentvalues_result == $this->excepted_result) &&
                ($this->delete_metavalues_result == $this->excepted_result) &&
                ($this->delete_modulesettings_result == $this->excepted_result)
                ){
            $this->action_handler = new Modulemanager_Data_Modulemanagerredirect;
            return $this->action_handler->main($variables);
        }
        else {
            $this->action_handler = new Modulemanager_Data_Moduleerrormessage;
            return $this->action_handler->main($variables);
        }
    }
}
